import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// element-plus按需引入
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    })],

  server: {
    // 设置服务启动端口号
    port: 3300,
    // 启动项目后自动打开浏览器
    open: true,
    // 允许跨域
    cors: true,
    // 打开热更新
    hmr: true
  },
  // 设置别名
  resolve: {
    alias: {
      '@': '/src',
      'comps': '/src/components',
      'views': '/src/views',
    }
  },

})
